pub fn convert_base(num_str: &str, to_base: u32) -> String {
    let base: u32 = num_str
        .split_at(num_str.len() - 1)
        .0
        .split_once('(')
        .unwrap()
        .1
        .parse()
        .unwrap();
    let mut val = 0;
    let mut weight = 1;

    for c in num_str.split_once('(').unwrap().0.chars().rev() {
        val += c.to_digit(base).unwrap() * weight;
        weight *= base;
    }

    let mut res = String::new();
    while val > 0 {
        let num = val % to_base;
        let num_char = if num < 10 {
            char::from_digit(num, 10).unwrap()
        } else {
            (b'a' + num as u8 - 10) as char
        };
        res.push(num_char);

        val /= to_base;
    }
    res.chars().rev().collect()
}
